package com.bawei.cargroup.view;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.RelativeLayout;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.Fragment;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.bawei.cargroup.R;
import com.blankj.utilcode.util.BarUtils;

@Route(path = "/cargroup/carlistactivity")
public class CarListActivity extends AppCompatActivity {

    private RelativeLayout carlistGroup;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_carlist);
        initView();

        Fragment fragment = (Fragment) ARouter.getInstance().build("/cargroup/carfragment").navigation();
        getSupportFragmentManager().beginTransaction().replace(R.id.carlist_group, fragment)
                .commit();
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
            getWindow().getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
            //把状态栏标记为浅色，然后状态栏的字体颜色自动转换为深色
        }
        int color = getResources().getColor(com.bawei.mvvmcomm.R.color.common_blue);
        BarUtils.setStatusBarColor(this, color);
        //添加让出状态栏高度->防止contentView布局绘制到状态栏上
        BarUtils.addMarginTopEqualStatusBarHeight(carlistGroup);
    }

    private void initView() {
        carlistGroup = (RelativeLayout) findViewById(R.id.carlist_group);
    }
}